﻿using Dapper;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Asion.Dapper
{
    public interface IDbConnectionFactory
    {
        /// <summary>
        /// create connetcion
        /// </summary>
        /// <param name="connectionName"></param>
        /// <returns></returns>
        IDbConnection CreateConnection(string name);


        /// <summary>
        /// get master connection
        /// </summary>
        /// <returns></returns>
        IDbConnection GetMasterConnection();


        /// <summary>
        /// change default db connection  
        /// </summary>
        void ChangeMasterConnection(string name);

        /// <summary>
        /// get connection count
        /// </summary>
        /// <returns></returns>
        int GetCount();


        /// <summary>
        /// 获取db type
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        DatabaseType GetDbType(string name);


        /// <summary>
        /// init 
        /// </summary>
        void Initialize(IEnumerable<DbConfiguration> dbConfigurations);


         /// <summary>
        /// init 
        /// </summary>
        void Initialize(DbConfiguration dbConfigurations);

        /// <summary>
        /// add configuraiton
        /// </summary>
        /// <param name="dbConfigurations"></param>
        void AddDbConfiguration(DbConfiguration dbConfigurations);

        /// <summary>
        /// add configuraiton
        /// </summary>
        /// <param name="dbConfigurations"></param>
        void AddDbConfigurations(IEnumerable<DbConfiguration> dbConfigurations);
    }

}
